Windows Terminal美化

配置WT

配置内容:(重点在defaults)

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "id": "User.copy.644BA8F2",
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "id": "User.paste",
            "keys": "ctrl+v"
        },
        {
            "command": "find",
            "id": "User.find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "id": "User.splitPane.A6751878",
            "keys": "alt+shift+d"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "newTabMenu": 
    [
        {
            "type": "remainingProfiles"
        }
    ],
    "profiles": 
    {
        "defaults": 
        {
            "adjustIndistinguishableColors": "indexed",
            "background": "#0E0F28",
            "backgroundImage": "C:/Users/Public/Pictures/\u58c1\u7eb8/\u9501\u5c4f/\u4e8c\u6b21\u5143/bca57db8436842bdb4270b29eb682476.jpg",
            "backgroundImageOpacity": 0.2,
            "colorScheme": "Tango Dark",
            "elevate": true,
            "font": 
            {
                "face": "FiraCode Nerd Font"
            },
            "opacity": 80,
            "useAcrylic": true
        },
        "list": 
        [
            {
                "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "\u547d\u4ee4\u63d0\u793a\u7b26"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            }
        ]
    },
    "schemes": [],
    "themes": [],
    "useAcrylicInTabRow": true
}

安装与配置oh-my-posh

oh-my-posh官网

安装oh-my-posh

还有其他很多安装办法,推荐从微软商店安装

winget install JanDeDobbeleer.OhMyPosh -s winget

修改配置

在用户文档路径下的WindowsPowerShellPowerShell, 中的Microsoft.PowerShell_profile.ps1配置文件

文件若不存在则可执行命令: New-Item -Path $PROFILE -Type File -Force

修改配置如下:(皮肤有Bug,暂未解决)

[Console]::OutputEncoding = [Text.Encoding]::UTF8
#oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/if_tea.omp.json" | Invoke-Expression
oh-my-posh init pwsh | Invoke-Expression

安装字体

字体官网 ,推荐使用字体FiraCode Nerd Font

使用下面命令可以快捷安装字体

oh-my-posh font install